package com.fis.test3.Repository;

import com.fis.test3.model.BindingData;
import com.fis.test3.model.FiberPerpare;
import com.fis.test3.model.FiberTypes;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface FTRepository extends JpaRepository<FiberTypes,Long> {
    //查询用户名称包含username字符串的用户对象
    List<FiberTypes> findBycontractIdContaining(String contractId);

    @Query("select p from FiberTypes p where p.fibTypeName=:fibTypeName and p.contractId=:contractId")
    FiberTypes withNameAndAddressQuery(@Param("fibTypeName") String fibTypeName, @Param("contractId") String contractId);

    //精确匹配username的用户对象
    FiberTypes getBycontractIdIs(String username);

    FiberTypes save(FiberTypes ft);
   // boolean existsByContractId(String ContractId);
    boolean existsByContractIdAndFibTypeNameAndFiberLength(String ContractId,String FibTypeName,int FiberLength);

    @Query("select F from FiberTypes F where F.contractId = :contractId")
    List<FiberTypes>  findFibTypeNameLengthLike(@Param("contractId") String contractId);
}
